/*
 * Complex.h
 *
 *  Created on: Apr 20, 2013
 *      Author: Marlon
 */

/*! @file Definition of the class Complex
 *
 */

#ifndef COMPLEX_H_
#define COMPLEX_H_

#include <ostream>
#include <cmath>
#include "const.h"
//! Namespace math contain the core classes of this library.
namespace math {


//! Class Complex implements a complex number notation
class Complex {
public:
	//! Basic constructor without values
	/*!
	 * This constructor starts the variable with zero values, e.g., (0)+j(0).
	 */
	Complex();
	//! Basic constructor with only a real value
	/*!
	 * This constructor starts the variable with a real value and zero imaginary value.
	 * \param _real Real value of the Complex variable.
	 *
	 */
	Complex(double _real);
	//! Basic constructor with a real and an imaginary values
	/*!
	 * This constructor starts the variable with the arguments values
	 * \param _real Real value of the Complex variable.
	 * \param _imag Imaginary value of the Complex variable.
	 */
	Complex(double _real ,double _imag);

	//! Return the real value of the complex variable
	/*!
	 * \return The real value.
	 */
	double getReal();

	//! Return the imaginary value of the complex variable
	/*!
	 * \return The imaginary value.
	 */
	double getImag();

	//! Return the phase of the complex variable
	/*!
	 * \return The phase,angle value.
	 */
	double getPhase();

	//! Return the module value of the complex variable
	/*!
	 * \return The module value.
	 */
	double getModule();

	double getReal() const;
	double getImag() const;
	double getPhase() const;
	double getModule() const;

	Complex operator+(const Complex& _x);
	Complex operator-(const Complex& _x);
	Complex operator*(const Complex& _x);
	Complex operator/(const Complex& _x);

	const Complex operator+=(const Complex& _x);
	const Complex operator-=(const Complex& _x);
	const Complex operator*=(const Complex& _x);
	const Complex operator/=(const Complex& _x);

	//!Return the conjugate of the complex number
	Complex operator~();

	//! return the complex number powered by _x
	Complex operator^( const double& _x); // power

	//! Compares if two complex number are not equals
	bool operator!=(const Complex& _x);

	//! Compares if two complex number are equals
	bool operator==(const Complex& _x);


	friend std::ostream& operator<<(std::ostream& os, const math::Complex& c);
private:
	double real,imag;
};


} /* namespace math */
#endif /* COMPLEX_H_ */

